﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace shop.Areas.Main.Controllers
{
    public class ThuongHieuController : Controller
    {
        private LongHAEntities db = new LongHAEntities();

        //
        // GET: /ThuongHieu/

        public ActionResult Index()
        {
            return View(db.ThuongHieux.ToList());
        }

        //
        // GET: /ThuongHieu/Details/5

        public ActionResult Details(int id = 0)
        {
            ThuongHieu thuonghieu = db.ThuongHieux.Find(id);
            if (thuonghieu == null)
            {
                return HttpNotFound();
            }
            return View(thuonghieu);
        }

        //
        // GET: /ThuongHieu/Create

        //public ActionResult Create()
        //{
        //    return View();
        //}

        ////
        //// POST: /ThuongHieu/Create

        //[HttpPost]
        //[ValidateAntiForgeryToken]
        //public ActionResult Create(ThuongHieu thuonghieu)
        //{
        //    Random rd = new Random();
        //    thuonghieu.IdCha = rd.Next(15, 2000);
        //    if (ModelState.IsValid)
        //    {
        //        db.ThuongHieux.Add(thuonghieu);
        //        db.SaveChanges();
        //        return RedirectToAction("Index");
        //    }

        //    return View(thuonghieu);
        //}

        ////
        //// GET: /ThuongHieu/Edit/5

        //public ActionResult Edit(int id = 0)
        //{
        //    ThuongHieu thuonghieu = db.ThuongHieux.Find(id);
        //    if (thuonghieu == null)
        //    {
        //        return HttpNotFound();
        //    }
        //    return View(thuonghieu);
        //}

        ////
        //// POST: /ThuongHieu/Edit/5

        //[HttpPost]
        //[ValidateAntiForgeryToken]
        //public ActionResult Edit(ThuongHieu thuonghieu)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        db.Entry(thuonghieu).State = EntityState.Modified;
        //        db.SaveChanges();
        //        return RedirectToAction("Index");
        //    }
        //    return View(thuonghieu);
        //}

        ////
        //// GET: /ThuongHieu/Delete/5

        //public ActionResult Delete(int id = 0)
        //{
        //    ThuongHieu thuonghieu = db.ThuongHieux.Find(id);
        //    if (thuonghieu == null)
        //    {
        //        return HttpNotFound();
        //    }
        //    return View(thuonghieu);
        //}

        ////
        //// POST: /ThuongHieu/Delete/5

        //[HttpPost, ActionName("Delete")]
        //[ValidateAntiForgeryToken]
        //public ActionResult DeleteConfirmed(int id)
        //{
        //    ThuongHieu thuonghieu = db.ThuongHieux.Find(id);
        //    db.ThuongHieux.Remove(thuonghieu);
        //    db.SaveChanges();
        //    return RedirectToAction("Index");
        //}

        protected override void Dispose(bool disposing)
        {
            db.Dispose();
            base.Dispose(disposing);
        }
    }
}